package com.pf.business.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author PanFei
 * @version 1.0.0
 * @createTime 2023/7/15 19:01
 */
@Getter
@AllArgsConstructor
public enum BillTypeEnum {

    INCOME(0, "收益"),
    EXPAND(1, "支出");

    private Integer code;
    private String message;

    public static String getMessageByCode(Integer code) {
        BillTypeEnum[] enums = BillTypeEnum.values();
        for (BillTypeEnum e : enums) {
            if (e.getCode().equals(code)) {
                return e.getMessage();
            }
        }
        return null;
    }

    public static Integer getCodeByMessage(String message) {
        BillTypeEnum[] enums = BillTypeEnum.values();
        for (BillTypeEnum e : enums) {
            if (e.getMessage().equals(message)) {
                return e.getCode();
            }
        }
        return null;
    }

}
